Vaadin Calendar events not shown if overnight [migrated]
Posted
by
B_B
on Programmers
See other posts from Programmers
or by B_B
Published on 2014-08-21T09:20:27Z
Indexed on
2014/08/21
10:29 UTC
Read the original article
Hit count: 249
vaadin
In my vaadin project there is the possibility to create events that are shown by the calendar. It does works, except when the event is overnight, let's say the night from 23th to 24th, and the calendar shows as only day the 24th. In this case the part of the event that belongs to the 24th is supposed to be shown, but it is not. When I switch to weekly view, the event is shown properly. Here is the function where I get the data and use a container for the calendar:
/* Fill Calendar from database */
void updateData() {
final BeanItemContainer<TypeReservationEvent> container =
new BeanItemContainer<TypeReservationEvent>(TypeReservationEvent.class);
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("roomParent",chosenRoom);
String query = "SELECT DISTINCT res FROM EntityReservation res, EntityRoom r, EntityTable rt WHERE res.tableId = rt.id "
+ "AND rt.roomParent =:roomParent";
reservationList = facade.list(query, parameters);
for(EntityReservation rt : reservationList) {
container.addBean(new TypeReservationEvent(rt));
}
container.sort(new Object[]{"start"}, new boolean[]{true});
cal.setContainerDataSource(container, "caption",
"description", "start", "end", "styleName");
// Force calendar to refresh
if(selectCalViewType.getValue() == chooseWeeklyView) {
setViewType(calViewType.DAILY);
setViewType(calViewType.WEEKLY);
} else if (selectCalViewType.getValue() == chooseDailyView) {
setViewType(calViewType.WEEKLY);
setViewType(calViewType.DAILY);
}
}
TIA
© Programmers or respective owner